﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace RegularExpressions
{
    class Program
    {
        static void Main(string[] args)
        {
            //5. Write a program that validates real numbers. For example: "0", "33", "-2381.78132", "4.3347", "12.00" and "0.34" are valid, but "+3", "--2", "24 543", "01.23", "12.", "11,23" and "12е7" are invalid.

            Regex regex = new Regex(@"(\A(0|[1-9][0-9]*)\.[0-9]+\Z)|(\A(0|[1-9])[0-9]*\Z)|(\A-[1-9][0-9]*([.][0-9]+)?\Z)|(\A-[1-9][0-9]*\Z)
|(\A-0[0-9]*[1-9]\.[0-9]+\Z)");
            string[] text = {"0","0.0","0.5","1.55","1","150","30","-30","-1.55","-0","-0.0","+5","4.","2-3","0 5","..25","5..5",
                            "5.5.5","1.5e7",".0","-.5",".5","-00.5","00.25"};
            foreach (var item in text)
            {
                // Match match = regex.IsMatch(item);
                if (regex.IsMatch(item) == true)
                {
                    Console.WriteLine(item + " valid");
                }
                else
                {
                    Console.WriteLine(item + " invalid");
                }
            }







        }
    }
}
